<?php
//include "config/koneksi.php";
include "class/hubungi_kami.php";
if (ISSET($_POST["contact_us"]) && $_POST['nama']!="" && $_POST['email']!="" && $_POST['pesan']!=""){

				$Kontak_Dao = new Kontak_Dao();
				$kontak=new Kontak();
				$kontak->nama = $_POST['nama'];
				$kontak->email = $_POST['email'];
				$kontak->pesan = $_POST['pesan'];
				$kontak->tanggal = $_POST['tanggal'];
				$Kontak_Dao->add($kontak);
				echo "<script>alert('Terima Kasih Anda telah mengirimkan pesan kepada Kami. Pesan Anda akan Kami respon secepatnya!');
				location.href='?';
				</script>";			
		} 

?>
<html>
<head>
  <link rel="stylesheet" href="css/val.css" type="text/css" />
<script type="text/javascript" src="js/jquery-1.4.js"></script>
  <script type="text/javascript" src="js/jquery.validate.js"></script>
  <script type="text/javascript">
		$(document).ready(function() {
			$("#form1").validate({
				rules: {
				nama: "required",
          		email: {				
					required: true,
					email: true
				},
				pesan: "required",
				},
			
      	messages: { 
			    nama: {
				    required: '. Nama harus di isi'
			    },
			    email: {
				    required: '. Email harus di isi',
				    email   : '. Email harus valid'
			    },
				pesan: {
				    required: '. Pesan harus di isi'
			    },
			   },
         
         success: function(label) {
            label.text('OK!').addClass('valid');
         }
			});
		});
	</script>
<title>Input Toko</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div class="form-div">
	<form id= "form1" method="post" action="?menu=hubungi_kami" >
	<input type="hidden" name="contact_us" >
	<input type="hidden" name="tanggal" value=<?php echo date("Y-m-d"); ?>>
	<table width="94%" border="0" align="center">
    <tr valign="top"> 
      <td colspan="2"></td><td height="19"><font size="2" face="tahoma">Silahkan Isi Pesan Anda :<font color="#FFFFFF"> </font></font></td>
    </tr>
	<tr valign="top"> 
				  <td width="21%" align="center"> <div align="left"><font size="2" face="tahoma">Nama</font></div></td>
				  <td width="1%">:</td>
				  <td width="78%" align="center"> <div align="left"> <font size="2" face="tahoma"> 
				  <input name="nama" type="text" id="nama" size="30" maxlength="50">
				  </font></div></td>
			</tr>
				<tr valign="top"> 
				  <td align="center"> <div align="left"><font size="2" face="tahoma">E-Mail</font></div></td>
				  <td>:</td>
				  <td align="center"> <div align="left"> <font size="2" face="tahoma"> 
					  <input name="email" type="text" id="email" size="50" maxlength="50">
					   <br><br>
					  Ex : abcde@gmail.com 
					  </font></div></td>
				</tr>
				<tr valign="top"> 
				  <td align="center"> <div align="left"><font size="2" face="tahoma">Isi Pesan</font></div></td>
				  <td>:</td>
				  <td align="center"> <div align="left"> <font size="2" face="tahoma"> 
				  <textarea name="pesan" cols="40" rows="4" id="pesan"></textarea>
				  </font></div></td>
			</tr>
		<tr>
            <tr valign="top"> 
				  <td colspan="2"></td><td height="21">
				  <label>
				  <input type="submit" name="submit" value="Kirim">
				  </label></td>
			</tr>
    </table></div>
	</form>
	<table width=94% align=center><tr>
	<td align=justify>
	<div class="tab_bdr"></div>
	<div class="panel" id="panel1" style="display: block;">
	<table width=95% align=center><tr><td align=justify><font size=2>
	Atau Hubungi Kami di :
</font>
</td></tr></table></div>
<br />  
</td></tr></table>
</body>
</html>

